//配置参数
/**
 * devServer.proxy
 * 如果你的前端应用和后端api服务器没有运行在同一个主机上，你需要在开发环境下将
 * api请求进行拦截
 */
const setting = require('./src/settings.js')
const title = setting.title

const path = require('path')
function resolve(dir) {
  return path.join(__dirname, dir)
}

const port = 8029 // 端口

module.exports = {
  publicPath: './',
  outputDir: 'dist',
  assetsDir: 'static',
  devServer: {
    port: port,
    proxy: {
      '/api': {
        target: 'https://gitee.com/api/v5',
        ws: false,
        changeOrigin: true,
        pathRewriter: {//重写路径
          '^/api': ''
        }
      }
    }
  },
  configureWebpack: {
    // provide the app's title in webpack's name field, so that
    // it can be accessed in index.html to inject the correct title.
    name: title,
    resolve: {
      alias: {
        '@': resolve('src')
      }
    }
  },
}